﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace GLYFrom.GLYGL
{
    public partial class GLY_update : Form
    {
        public GLY_update()
        {
            InitializeComponent();
        }
        int id = 0;
        public GLY_update(int a)
        {
            id = a;
            InitializeComponent();
        }
        private void GLY_update_Load(object sender, EventArgs e)
        {
            DataTable table=DBHelper.select(string.Format("select * from T_GuanLiYuan where GLYId='{0}'",id));
            DataRow row = table.Rows[0];
            this.text_Name.Text=row["Name"].ToString();
            this.text_ZhangHao.Text = row["ZhangHao"].ToString();
            this.text_MiMa.Text = row["MiMa"].ToString();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string Name = this.text_Name.Text.Trim();
            string ZhangHao = this.text_ZhangHao.Text.Trim();
            string MiMa = this.text_MiMa.Text.Trim();
            int sr = DBHelper.ZSG(string.Format("update T_GuanLiYuan set Name='{0}',ZhangHao='{1}',MiMa='{2}'",Name,ZhangHao,MiMa));
            if (sr > 0)
            {
                MessageBox.Show("修改成功！");
                this.Close();
            }
            else
            {
                MessageBox.Show("修改失败！");
            }
            
        }
    }
}
